<!--分页组件-->
<template>
  <el-pagination
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
    :current-page="currentpage"
    :page-sizes="[20, 50, 100]"
    :page-size="pagesize"
    :layout="layout"
    :total="total"
    style="float:right;">
  </el-pagination>
</template>
<script>
  export default {
    name: 'Pagination',
    props: {
      pagesize: [Number, String],
      currentpage: [Number, String],
      total: [Number, String],
      options: [Object],  // 分页发生变化赋值给options
      render: [Function], // 跳转触发的请求
      layout: {
        type: String,
        default: 'sizes, prev, pager, next'
      }
    },
    methods: {
      handleSizeChange(val) {
        this.options.page = 1;
        this.options.pageNum = val;
        this.render();
      },
      handleCurrentChange(val) {
        this.options.page = val;
        this.render();
      }
    }
  };
</script>